package com.docted.design.pattern.singleton.lazy;

/**
 * @author DoCted
 * @since v1.0 2018/3/7
 */
public class LazyTwo {
    /**
     * 默认在加载时候不实例化
     *  在去显式获取实例的时候才去实例化
     * 延时加载
     */


    private LazyTwo() {

    }

    private static LazyTwo lazyOne = null;


    /**
     * 同步模式获取实例
     */
    public synchronized static LazyTwo getInstance() {
        if (lazyOne == null) {
            lazyOne = new LazyTwo();
        }
        return lazyOne;
    }

}
